<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/commons/global.jsp" %>
<style>
</style>
<script type="text/javascript">
    $(function() {
        $('#workPlanEdit_type').val('${workPlan.type}');
        CKEDITOR.replace( 'workplanEdit_content',{
            filebrowserImageUploadUrl: '${ctxPath}/ckeditor/uploadImg',
            language : 'zh-cn'
        });
        $('#workPlanEditForm').form({
            url : '${path}/workPlan/edit',
            onSubmit : function() {
                progressLoad();
                var isValid = $(this).form('validate');
                if (!isValid) {
                    progressClose();
                }
                return isValid;
            },
            success : function(result) {
                progressClose();
                result = $.parseJSON(result);
                if (result.success) {
                    showMsg(result.msg);
                    parent.$.modalDialog.openner_dataGrid.datagrid('reload');//之所以能在这里调用到parent.$.modalDialog.openner_dataGrid这个对象，是因为user.jsp页面预定义好了
                    parent.$.modalDialog.handler.dialog('close');
                    parent.$.modalDialog.openner_treeGrid.treegrid('reload');//之所以能在这里调用到parent.$.modalDialog.openner_dataGrid这个对象，是因为user.jsp页面预定义好了
                    parent.$.modalDialog.handler.dialog('close');
                } else {
                    var form = $('#workPlanEditForm');
                    parent.$.messager.alert('错误', result.msg, 'error');
                }
            }
        });
    });
</script>
<div class="easyui-layout" data-options="fit:true,border:false">
    <div data-options="region:'center',border:false" title="" style="overflow-x:hidden;overflow-y: auto;padding: 3px;">
        <form id="workPlanEditForm" method="post">
            <input type="hidden" name="id" value='${workPlan.id}'/>
            <input type="hidden" name="userid" value='${workPlan.userid}'/>
            <table class="grid">
                <tr>
                    <td>标题</td>
                    <td colspan="3">
                        <input name='name' value="${workPlan.name}"  type='text' placeholder='请输入标题' class='easyui-text-2 span2 easyui-validatebox' style="width: 90%" data-options="required:true">
                    </td>
                </tr> <tr>
                <td>计划类别</td>
                <td>
                    <input name='planBelongTo' value="${workPlan.planBelongTo}"  type='text' placeholder='请输入如个人计划、部门计划等' class='easyui-text-2  span2' style="width:90%;">
                </td>
                <td>类型</td>
                <td>
                    <select name="type" class="easyui-text-2 easyui-validatebox" data-options="required:true" id="workPlanEdit_type">
                        <option value="">请选择</option>
                        <option value="0">日计划</option>
                        <option value="1" selected>周计划</option>
                        <option value="2">月计划</option>
                        <option value="3">季度计划</option>
                        <option value="4">年度计划</option>

                    </select>
                </td>
            </tr>
                <tr>
                    <td>计划内容</td>
                    <td colspan="3">
                        <textarea name='content' id='workplanEdit_content' rows="10" cols="80">${workPlan.content}</textarea>
                    </td>
                </tr>
                <tr>
                    <td>审批人</td>
                    <td colspan="3">
                        <input type="hidden" name="commentators" id="workplanEdit_commentators" value="${workPlan.commentators}"/>
                        <input type="text"  class="easyui-text-2" id="workplanEdit_commentators_disp" readonly="readonly"  placeholder="请选择" style="width: 60%" value="${workPlan.commentatorNames}"/>
                        <a href="javascript:void(0)" onclick="selectUser(true,'workplanEdit_commentators','workplanEdit_commentators_disp')" class="easyui-linkbutton">选择</a>
                    </td>
                </tr>
                <tr>
                    <td>抄送人</td>
                    <td colspan="3">
                        <input type="hidden" name="useridCcs" id="workplanEdit_useridCcs" value="${workPlan.useridCcs}"/>
                        <input type="text"  class="easyui-text-2" id="workplanEdit_useridCcs_disp" readonly="readonly"  placeholder="请选择" style="width: 60%" value="${workPlan.userNameCcs}"/>
                        <a href="javascript:void(0)" onclick="selectUser(true,'workplanEdit_useridCcs','workplanEdit_useridCcs_disp')" class="easyui-linkbutton">选择</a>
                    </td>
                </tr>
                <tr>
                    <td>附件</td>
                    <td colspan="3">
                        <input name='attachIds' id="workplanEdit_attachfile_input"  type="hidden"/>
                        <div id="workplanEdit_attachfile_input_disp">
                            <c:forEach var="attach"
                                       items="${workPlan.attachList}">
                            <p>${attach.name}
                                <c:if test="${attach.type=='pdf'}">
                                <a style='margin-left: 20px;'
                                   href='/jsp/pdfjs/web/viewer.html?file=/pdfView/view?name%3d${attach.id}'
                                   target='_blank'>在线预览</a>
                                </c:if>
                                <a style='margin-left: 20px;' href='javascript:void(0)'
                                   onClick='downloadAttach("${attach.id}")'>下载</a>
                                <a style='margin-left: 20px;' href='javascript:void(0)'
                                   onClick='delAttach("${attach.id}",this,"workplanEdit_attachfile_input")'>删除</a>
                                </c:forEach>
                        </div>
                        <a onclick="attachUpload('workplanEdit_attachfile_input','workplanEdit_attachfile_input_disp');" href="javascript:void(0);" class="easyui-linkbutton" data-options="plain:true,iconCls:'fi-plus icon-green'">增加附件</a>
                    </td>
                </tr>
            </table>
        </form>
    </div>
</div>